clear
set more off

*cd " "

**Generating dataset for analysis of Turkish public opinion towards immigrants 
**using Waves 5-7 of WVS
cd "~/Dropbox/Syrian Refugees - Grant Applications/Online Conjoint Experiment - Turkey/Data"



use WVS_Turkey_Wave5_short


keep V257 V39 V42 V37 V235 V237 V238 V45


rename V42 neighbour_language
rename V39 neighbour_religion
rename V37 neighbour_immigrant
rename V235 sex
rename V237 age
rename V238 education
rename V45 jobs 


generate region=.
replace region=1 if V257==792041
replace region=2 if V257==792042
replace region=3 if V257==792043 
replace region=4 if V257==792044 
replace region=5 if V257==792045 
replace region=6 if V257==792046 
replace region=7 if V257==792047
replace region=8 if V257==792048 
replace region=9 if V257==792049
replace region=10 if V257==792050
replace region=11 if V257==792051 
replace region=12 if V257==792052

gen wave=1

append using WVS_Turkey_Wave6_short, 
append using WVS_Turkey_Wave7_short

replace neighbour_immigrant=. if neighbour_immigrant==-2 | neighbour_immigrant==-1
replace neighbour_language=. if neighbour_language==-2 | neighbour_language==-1
replace neighbour_religion=. if neighbour_religion==-2 | neighbour_religion==-1

replace neighbour_immigrant=neighbour_immigrant-1
replace neighbour_language=neighbour_language-1
replace neighbour_religion=neighbour_religion-1
****1 if do not mention that they don't want them to be neighbors, 0 if they mention
****In the original, 1=mention, 2=don't mention


gen jobs_agree=1 if jobs==1
replace jobs_agree=0 if jobs!=1
*original 1=agree, 2=neither, 3=disagree, 7=no answer, 8=don't know


****Reversing
recode neighbour_* (0=1) (1=0), prefix(new_)
la var new_neighbour_immigrant "0 if didn't mention that doesn't want an immigrant, 1 if mentioned"
la var new_neighbour_religion "0 if didn't mention that doesn't want a neighbour with a diff lang, 1 if mentioned"
la var new_neighbour_language "0 if didn't mention that doesn't want a neighbour with a diff lang, 1 if mentioned"
la var jobs_agree "0 if didn't agree that employers should prioritize locals over immigrants when jobs are scarce, 1 if agree"
tab jobs


keep wave neighbour_immigrant neighbour_language neighbour_religion jobs_agree
order wave neighbour_immigrant neighbour_language neighbour_religion jobs_agree

*save wvs_data_refugees, replace


